TARGET = epollTest

SOURCES = \
    src/Epoll.cpp \
    src/EpollException.cpp \
    src/epollTest.cpp 

OBJECTS = $(subst .cpp,.o,$(SOURCES))

INCLUDE += 
LIB += 

CXX_FLAGS += -O2  -fPIC -Wall 

CC=$(GCC_PREFIX)gcc
CXX=$(GCC_PREFIX)g++
AR=$(GCC_PREFIX)ar
AS=$(GCC_PREFIX)as
LD=$(GCC_PREFIX)ld
NM=$(GCC_PREFIX)nm
RANLIB=$(GCC_PREFIX)ranlib
STRIP=$(GCC_PREFIX)strip
OBJCOPY=$(GCC_PREFIX)objcopy
OBJDUMP=$(GCC_PREFIX)objdump
READELF=$(GCC_PREFIX)readelf
XML_FILE=$(TARGET).xml

all: $(TARGET)

$(TARGET): $(OBJECTS)
	$(CXX) $(CXX_FLAGS) -o $@ $^ $(LIB)

$(OBJECTS): %.o: %.cpp
	 $(CXX) $(CXX_FLAGS) -c $^ -o $@ $(INCLUDE)


# fix bin and so file to special direction
install:
	mkdir -p ../bin/$(PREFIX)
	install -m 774 $(TARGET) ../bin/$(PREFIX)

clean:
# ifeq ($(TARGET), $(wildcard $(TARGET)))
	rm -f $(TARGET)
	find . -name *.o -exec rm {} \;
# endif
ifeq (build, $(wildcard build))
	rm -rf build
endif
